<?php
declare(strict_types=1);
namespace Field;

class SysTakeConst
{
    public const pk='TakeID';
    public const index=['TakeID'];
	public const fields=['TakeID','UserID','CreateAt','Status','IP','Node','Take'];
	public const comment=['TakeID'=>'操作记录ID','UserID'=>'用户ID','CreateAt'=>'操作时间','Status'=>'1成功0失败','IP'=>'IP地址','Node'=>'Node','Take'=>'操作内容'];
	/*
    * @Field TakeID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 操作记录ID
    */
    public const TakeID = 'TakeID';
    /*
    * @Field UserID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 用户ID
    */
    public const UserID = 'UserID';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 操作时间
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field Status
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 1成功0失败
    */
    public const Status = 'Status';
    /*
    * @Field IP
    * @Type varchar(20)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment IP地址
    */
    public const IP = 'IP';
    /*
    * @Field Node
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment Node
    */
    public const Node = 'Node';
    /*
    * @Field Take
    * @Type varchar(200)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 操作内容
    */
    public const Take = 'Take';
}

class SysTakeColumns
{
public  int $TakeID;
   public  int $UserID;
   public  ?string $CreateAt='';
   public  int $Status=0;
   public  ?string $IP='';
   public  ?string $Node='';
   public  ?string $Take='';
	public function toArray():array
	{
		return [
'TakeID'=>$this->TakeID,
    'UserID'=>$this->UserID,
    'CreateAt'=>$this->CreateAt,
    'Status'=>$this->Status,
    'IP'=>$this->IP,
    'Node'=>$this->Node,
    'Take'=>$this->Take,        ];
	}
}

class SysTakeRow
{
	public SysTakeColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'TakeID' => $this->data->TakeID,
        'UserID' => $this->data->UserID,
        'CreateAt' => $this->data->CreateAt,
        'Status' => $this->data->Status,
        'IP' => $this->data->IP,
        'Node' => $this->data->Node,
        'Take' => $this->data->Take, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysTakeColumns();
        isset($data['TakeID']) && $this->data->TakeID = (int)$data['TakeID'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
           isset($data['IP']) && $this->data->IP = (string)$data['IP'];
           isset($data['Node']) && $this->data->Node = (string)$data['Node'];
           isset($data['Take']) && $this->data->Take = (string)$data['Take'];
    }
}
?>